﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Prism.Games.GalEngine.Scripts;

namespace Prism.Games.GalEngine.Scripts.Parser
{
    [Serializable]
    public class ParserState : Prism.ComponentModel.NotifyPropertyChangedBase
    {
        public Section section;
        public Section Section
        {
            get { return this.section; }
            set { this.section = value; this.OnPropertyChanged("Section"); }
        }
        public IScene scene;
        public IScene Scene
        {
            get { return this.scene; }
            set
            {
                this.scene = value; this.OnPropertyChanged("Scene");
                if (value is GamingScene)
                    this.GamingScene = value as GamingScene;
            }
        }

        public bool SceneIsSectionHead { get; set; }

        public GamingScene gamingScene;
        public GamingScene GamingScene
        {
            get { return this.gamingScene; }
            set { this.gamingScene = value; this.OnPropertyChanged("GamingScene"); }
        }

        private bool isNextEnd;

        public bool IsEnd
        {
            get { return isNextEnd; }
            set { isNextEnd = value; this.OnPropertyChanged("IsNextEnd"); }
        }

        private RunningMode runningMode;

        public RunningMode RunningMode
        {
            get { return runningMode; }
            set { runningMode = value; this.OnPropertyChanged("RunningMode"); }
        }

        /// <summary>
        /// 将状态至0；
        /// </summary>
        /// <param name="script"></param>
        public void StateInit(Script script)
        {
            this.Section = script.Sections[0];

            this.Scene = this.Section.Scenes[0];

            this.IsEnd = false;

            this.SceneIsSectionHead = false;
        }
    }
}
